dontforgetfandomcom_ru-20200215-history
Visualeditor mediawiki install
Mediawiki is a favorite of mine. It is simple to setup and everyone is familiar with the interface. Running a basic setup is reallt simple. However you may often want to customize the setup and this is when it starts to get complicated. At least for me. I wanted to use the Visual Editorn in order for the users to get a more simple interface. Visual Editor is already used on many languages on Wikipedia. If you would like to change the editor in WordPress, Joomla or any other cms this is very easy. But not in Mediawiki. I searched everywhere but could not find a simple tutorial how to do this. The setup below worked for me. However there might be errors or other incorrect settings that I have missed. In general the official documentation is quite poor. So here it is. Tutorial how to setup Mediawiki 1.25 with Visual Editor on Ubuntu 14.04 (Trusty) First of all you will need a fresh install of Ubuntu. Install with lamp and open ssh. I will not show this here. Make sure you can use ssh to connect. You will also need some kind of working dns. And some general Linux knowledge. Ok let´s start. Connect to your server and install phpmyadmin sudo apt-get install phpmyadmin Download mediawiki and unpack. Move the files. sudo wget https://releases.wikimedia.org/mediawiki/1.25/mediawiki-1.25.1.tar.gz sudo tar -xvzf mediawiki-*.tar.gz sudo mkdir /var/www/html/mediawiki sudo mv mediawiki-*/* /var/www/html/mediawiki Chown and Chmod cd /var/www/html/ sudo chmod 755 -R mediawiki sudo chown www-data:www-data -R mediawiki Create a virtual host You do not really have to do this but if you are using your server for many sites and want a nice dns name it might be a good idea. Create a config file sudo vi /etc/apache2/sites-available/mediawiki.conf It should look something like this ServerAdmin webmaster@localhost DocumentRoot /var/www/html/mediawiki ServerName mediawiki.mydomain.com ErrorLog "/var/log/mediawiki.log" CustomLog ${APACHE_LOG_DIR}/access.log combined Enable the site and restart apache. Also install phpmyadmin sudo a2ensite mediawiki.conf service apache2 reload sudo apt-get install phpmyadmin I had to reboot my server in order to get the new site in my browser. Now open your browser and go to http://servername/phpmyadmin. Create a database called mediawiki. Open your browser and go to http://mediawiki.mydomain.com. Now install Mediawiki. I won´t show all the details here but you should be fine with most standard settings. You can add some extensions when asked as some of those might be needed. Download the LocalSettings.php and put it in the root folder of Mediawiki. There are many other settings and extensions you my want but I will focus on how to get the Visual editor working here. I named my “wiki”. This is the name you should use later in the parsoid setup. Visual editor Download and install extension. sudo wget https://extdist.wmflabs.org/dist/extensions/VisualEditor-REL1_25-c1ed854.tar.gz sudo tar -xzf VisualEditor-REL1_25-c1ed854.tar.gz -C /var/www/html/mediawiki/extensions Add this to LocalSettings.php. See the official documantation for detailed descriptions. require_once "$IP/extensions/VisualEditor/VisualEditor.php"; $wgDefaultUserOptions'visualeditor-enable' = 1; $wgHiddenPrefs[] = 'visualeditor-enable'; $wgDefaultUserOptions'visualeditor-enable-experimental' = 1; $wgVisualEditorParsoidURL = 'http://mediawiki.mydomain.com:8142'; $wgVisualEditorParsoidPrefix = 'wiki'; $wgVisualEditorParsoidForwardCookies = true; UniversalLanguageSelector sudo wget https://extdist.wmflabs.org/dist/extensions/UniversalLanguageSelector-REL1_25-7661826.tar.gz sudo tar -xzf UniversalLanguageSelector-REL1_25-7661826.tar.gz -C /var/www/html/mediawiki/extensions Add the following code at the bottom of your LocalSettings.php: require_once "$IP/extensions/UniversalLanguageSelector/UniversalLanguageSelector.php"; Parsoid This is when it get complicated and this is where I have been stuck before. The secret is to make sure all settings are correct. Import the repository gpg key: gpg --keyserver keys.gnupg.net --recv-keys 5C927F7C gpg -a --export 5C927F7C | sudo apt-key add - Add this to sources list deb arch=amd64 http://parsoid.wmflabs.org:8080/deb wmf-production main sudo vi /etc/apt/sources.list And install sudo apt-get update && sudo apt-get install parsoid Open the configfile sudo vi /etc/mediawiki/parsoid/settings.js And change the line like this. Use the name you used in the mediawiki setup parsoidConfig.setInterwiki( 'wiki', 'http://mediawiki.white.local/api.php' ); Edit the settings below sudo vi /usr/lib/parsoid/src/api/localsettings.js And make sure it looks something like this: parsoidConfig.setInterwiki( 'wiki', 'http://mediawiki.mydomain.com/api.php', 'http://mediawiki.mydomain.com/' ); parsoidConfig.setInterwiki( 'foo', 'http://localhost/wikiarst/api.php' ); You can try now to see if it works… Not? Well I was quite frustrated until I found out you will need php5-curl. I could not find this documented anywhere. So install this. sudo apt-get install php5-curl Restart the parsoid service or reboot the server service parsoid restart If everything works it should look something like this when editing pages. Links to the official documentation https://www.mediawiki.org/wiki/Parsoid/Setup https://www.mediawiki.org/wiki/VisualEditor I also installed node when troubleshooting but I don´t think this is necessary.